<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>在线视频后台管理</title>
	<!-- jQuery -->
	<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>

	<!-- Bootstrap CSS -->
	<link href="https://cdn.bootcss.com/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">
	<!-- Bootstrap JavaScript -->
	<script src="https://cdn.bootcss.com/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
	<script src="/static/vue.js"></script>
	<script src="/static/axios.js"></script>
	<script type="text/javascript">
	axios.defaults.baseURL = '{:url("/")}';
	Vue.prototype.$http=axios;
	</script>
</head>
<style type="text/css">
  body { padding-top: 70px; }
	.mt-20{
		margin-top: 20px;
	}
	.pd{
		padding: 5px;
	}
	.panel-footer  {
		padding: 5px;
	}
	.panel-footer .pagination{
		margin: 0px;
		margin-top: 5px;

	}
	[v-cloak] {
    	display: none;
	}
</style>
<body>
<!-- 导航区域 -->
	<nav class="navbar navbar-inverse  navbar-fixed-top">
		<div class="container-fluid">
			<div class="row">
				<div class="col-sm-2">
					<div class="navbar-header">
					  <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
					    <span class="sr-only">视频后台</span>
					    <span class="icon-bar"></span>
					    <span class="icon-bar"></span>
					    <span class="icon-bar"></span>
					  </button>
					  <a class="navbar-brand" href="#">视频后台</a>
					</div>
				</div>
				<div class="col-sm-10">
					<div class="collapse navbar-collapse " id="navbar">
						<ul class="nav navbar-nav">
							<li class="active dropdown">
							  	<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{$Think.session.username}<span class="caret" style="margin-left:10px;"></span></a>
							  	<div class="dropdown-menu" style="width:320px;">
							  		<div class="info-body clearfix" style="padding:20px 20px 0px;">
						  				<div class="pull-left">
						  					<img  src="http://thirdwx.qlogo.cn/mmopen/CDzKlLQjUDHILvIR1oxjOfwrEX6pl0HW486DyF73TuZxDCEbt2HwYzYYibqNFbhyTMRrQR37qczCHhj8ErmSVibuZhEQhm8bga/132" style="width:100px;height:100px;border-radius:50%;margin:0px;padding:0px;">
						  				</div>
							  			<div class="pull-left" style="margin-left:20px;">
							  				<p>姓名：</p>
							  				<p>手机：</p>
							  				<p>安全等级：高</p>
							  			</div>
							  		</div>
							  		<hr>
							  		<div class="info-footer clearfix" style="padding:0px 20px 10px;">
										<button type="button" class="btn btn-default pull-left">个人信息</button>
										<button type="button" class="btn btn-default pull-right">注销</button>
							  		</div>
							  	</div>
							</li>
							<li><a href="#">角色</a></li>
							<li class="dropdown" style="width:200px;">
							  <a href="#" class="dropdown-toggle" data-toggle="dropdown"  aria-haspopup="true" aria-expanded="false" style="background-color: #2d2d2d;">{$Think.session.role_name} <span class="caret" style="position:absolute;right:5px;top:50%;transform: translateX(-50%);"></span></a>
							  <ul class="dropdown-menu" style="width:100%;">
							  {volist name="rolelist" id="v"}
							    <li><a href="javascript:void(0);" onclick="changeRole({$v.id});">{$v.role_name}</a></li>
							  {/volist}
							  </ul>
							</li>
						</ul>
						<ul class="nav navbar-nav navbar-right">
							<li><a href="#">前台</a></li>
							<li><a href="{:url('index/index')}">后台</a></li>
							<li><a href="{:url('index/logout')}">退出</a></li>
						</ul>
					</div>
				</div>
			</div>
		</div>
	</nav>
	<div class="container-fluid">
		<div class="row">
		<!-- 左侧导航 -->
			<div class="col-sm-2">
			{volist name="sys_menu" id="lm" }
				{volist name="lm.children" id="item" }
				<ul class="list-group">
					<a class="list-group-item active">{$item.menu_name}</a>
					{volist name="item.children" id="item_children"   }
					<a class="list-group-item"  href="{:url($item_children.menu_url)}" >{$item_children.menu_name}</a>
					{/volist}
				</ul>
				{/volist}
			{/volist}
			</div>
		<!-- 右侧导航 -->
			<div class="col-sm-10">
          		{__CONTENT__}
			</div>
		</div>
	</div>
</body>
</html>
<script type="text/javascript">
	function changeRole(id){
		var str="{:url('admin/index/changeRole',['id'=>'id'])}";
        url =  str.replace("id",id);
        if(url){
		$.ajax({
			type:'post',
			url,
			dataType:'json',
			async:false,
			success:function(data){
			    if(data.code==200){
			    	window.location.href="{:url('admin/index/index')}";
			    }else{
			       alert('切换失败')
			    }
			}
		})
    }

	}
</script>